using System;
using System.Globalization;
using System.Windows.Data;

namespace LayoutPlanning.Converters
{
    public class ZoomToWidth : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (!(value is double))
                return 2000;
            double res = (double)value;
            if (res < 0.01)
                return 100 * 1000*res;
            if (res < 0.1)
                return  10 * 1000*res;
            if (res < 0.5)
                return 2 * 1000*res;
            if (res < 1)
                return  1 * 1000*res;
            if (res < 2)
                return   0.5 * 1000*res;
            return  0.25*1000*res;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}